package cn.sdhuijin.healthexam.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;
import cn.sdhuijin.healthexam.util.Constants;

/**
 * 健康体检录入-第九页
 * 
 * @author houyuchun
 * 
 */
public class HealthExamEighthActivity extends AbstractControlActivity implements
		OnClickListener {

	private String createDate;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_health_exam_eighth);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		Bundle bundle = intent.getBundleExtra("bundle");
		if (bundle != null) {
			createDate = bundle.getString("createDate");
		}
		setCurrentEditUserName(createDate);

		addEditTextView(R.id.edt_zongdanguchun, "总胆固醇");
		addEditTextView(R.id.edt_ganyousanzhi, "甘油三酯");
		addEditTextView(R.id.edt_xueqingdmd, "血清低密度脂蛋白胆固醇");
		addEditTextView(R.id.edt_xueqinggmd, "血清高密度脂蛋白胆固醇");
		addEditTextView(R.id.edt_fuzhujc_qt, "辅助检查其他");

		addRadioGroupView(R.id.rad_xiongbuxx, "胸部X线片");
		addRadioGroupView(R.id.rad_bchao, "B超");
		addRadioGroupView(R.id.rad_gongjingtupian, "宫颈涂片");
		addRadioGroupView(R.id.rad_pinghezhi, "平和质");
		addRadioGroupView(R.id.rad_qixuzhi, "气虚质");
		addRadioGroupView(R.id.rad_yangxuzhi, "阳虚质");
		addRadioGroupView(R.id.rad_yinxuzhi, "阴虚质");
		addRadioGroupView(R.id.rad_danrezhi, "痰湿质");
		addRadioGroupView(R.id.rad_shirezhi, "湿热质");
		addRadioGroupView(R.id.rad_xueyuzhi, "血瘀质");
		addRadioGroupView(R.id.rad_qiyuzhi, "气郁质");
		addRadioGroupView(R.id.rad_tebingzhi, "特秉质");

		// Properties文件路径
		controlManager.setPropertiesPath(Constants.PROPERTIES_PATH + createDate
				+ ".txt");
		controlManager.toControl();
		this.setButtonListener(this, R.id.btn_next, R.id.btn_previous);
	}

	/**
	 * 按钮点击处理事件
	 */
	@Override
	public void onClick(View arg0) {
		Intent intent = new Intent();
		Bundle bundle = new Bundle();
		// 获取点击按钮
		int id = (Integer) arg0.getId();
		switch (id) {
		case R.id.btn_previous:
			controlManager.toProperties();
			bundle.putString("createDate", createDate);
			// 创建日期
			intent.putExtra("bundle", bundle);
			intent.setClass(this, HealthExamSeventhActivity.class);
			startActivity(intent);
			this.finish();
			break;
		case R.id.btn_next:
			controlManager.toProperties();
			bundle.putString("createDate", createDate);
			// 创建日期
			intent.putExtra("bundle", bundle);
			intent.setClass(this, HealthExamNinthActivity.class);
			startActivity(intent);
			this.finish();
			break;
		default:
			break;
		}
	}

}
